home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / spice.vim < prev    next >
Encoding:
Text File  |  2001-05-10  |  2.6 KB  |  88 lines

  1. " Vim syntax file
  2. " Language:    Spice circuit simulator input netlist
  3. " Maintainer:    Noam Halevy <Noam.Halevy.motorola.com>
  4. " Last Change:    12/08/99
  5. "
  6. " This is based on sh.vim by Lennart Schultz
  7. " but greatly simplified
  8.  
  9. " For version 5.x: Clear all syntax items
  10. " For version 6.x: Quit when a syntax file was already loaded
  11. if version < 600
  12.   syntax clear
  13. elseif exists("b:current_syntax")
  14.   finish
  15. endif
  16.  
  17. " spice syntax is case INsensitive
  18. syn case ignore
  19.  
  20. syn keyword    spiceTodo    contained TODO
  21.  
  22. syn match spiceComment  "^ \=\*.*$"
  23. syn match spiceComment  "\$.*$"
  24.  
  25. " Numbers, all with engineering suffixes and optional units
  26. "==========================================================
  27. "floating point number, with dot, optional exponent
  28. syn match spiceNumber  "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
  29. "floating point number, starting with a dot, optional exponent
  30. syn match spiceNumber  "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
  31. "integer number with optional exponent
  32. syn match spiceNumber  "\<[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
  33.  
  34. " Misc
  35. "=====
  36. syn match   spiceWrapLineOperator       "\\$"
  37. syn match   spiceWrapLineOperator       "^+"
  38.  
  39. syn match   spiceStatement      "^ \=\.\I\+"
  40.  
  41. " Matching pairs of parentheses
  42. "==========================================
  43. syn region  spiceParen transparent matchgroup=spiceOperator start="(" end=")" contains=ALLBUT,spiceParenError
  44. syn region  spiceSinglequote matchgroup=spiceOperator start=+'+ end=+'+
  45.  
  46. " Errors
  47. "=======
  48. syn match spiceParenError ")"
  49.  
  50. " Syncs
  51. " =====
  52. syn sync minlines=50
  53.  
  54. " Define the default highlighting.
  55. " For version 5.7 and earlier: only when not done already
  56. " For version 5.8 and later: only when an item doesn't have highlighting yet
  57. if version >= 508 || !exists("did_spice_syntax_inits")
  58.   if version < 508
  59.     let did_spice_syntax_inits = 1
  60.     command -nargs=+ HiLink hi link <args>
  61.   else
  62.     command -nargs=+ HiLink hi def link <args>
  63.   endif
  64.  
  65.   HiLink spiceTodo    Todo
  66.   HiLink spiceWrapLineOperator spiceOperator
  67.   HiLink spiceSinglequote      spiceExpr
  68.   HiLink spiceExpr             Function
  69.   HiLink spiceParenError       Error
  70.   HiLink spiceStatement        Statement
  71.   HiLink spiceNumber           Number
  72.   HiLink spiceComment          Comment
  73.   HiLink spiceOperator         Operator
  74.  
  75.   delcommand HiLink
  76. endif
  77.  
  78. let b:current_syntax = "spice"
  79.  
  80. " insert the following to $VIM/syntax/scripts.vim
  81. " to autodetect HSpice netlists and text listing output:
  82. "
  83. " " Spice netlists and text listings
  84. " elseif getline(1) =~ 'spice\>' || getline("$") =~ '^\.end'
  85. "   so <sfile>:p:h/spice.vim
  86.  
  87. " vim: ts=8
  88.